// src/main/java/com/easy/config/WEBConfig.java
package com.easy.config;

import com.easy.Interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WEBConfig implements WebMvcConfigurer {
    //添加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/api/**") // 拦截所有/api开头的请求
                .excludePathPatterns("/login/**", "/api/login/**", "/login/captcha", "/api/raw_material/**"); // 排除登录相关路径和原材料管理路径
    }
}